<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>demo</title>
  <script type="text/javascript" src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <input type="text" v-model="att">
    <ul>
      <li v-for="item of add">{{item.name}}--{{item.age}}--{{item.sex}}</li>
    </ul>
  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false
  const vm = new Vue({
    el: "#app",
    data() {
      return {
        att: '',
        person: [
          { name: '鹿晗', age: 20, sex: '男' },
          { name: '蔡徐坤', age: 24, sex: '男' },
          { name: '杨超越', age: 21, sex: '女' },
          { name: '杨幂', age: 36, sex: '女' }
        ]
      }
    },
    // 计算属性 
    computed: {
      add() {
        // 这里按条件进行筛选 并进行排序
        return this.person.filter(item => item.name.includes(this.att)).sort((a, b) => a.age - b.age)
      }
    }
  })
</script>

</html>